﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class ListDistributorNameDetail : NotifyPropertyChangeObject
    {
        private int distributorModelID;

        private string reference;       
        private string description;
        private string other;


        public ListDistributorNameDetail()
            : this(0, "", "", "")
        {
        }

        public ListDistributorNameDetail(int distributorModelID, string reference, string description, string other)
        {
            GlobalDefaultValue.Apply(this);

            this.distributorModelID = distributorModelID;
            this.Reference = reference;
            this.Description = description;
            this.Other = other;            
        }


        #region Properties

        [DefaultValue(0)]
        public int DistributorModelID
        {
            get { return this.distributorModelID; }
            set { ApplyPropertyChange<ListDistributorNameDetail, int>(ref this.distributorModelID, o => o.DistributorModelID, value); }
        }


        [DefaultValue(0)]
        public string Reference
        {
            get { return this.reference; }
            set { ApplyPropertyChange<ListDistributorNameDetail, string>(ref this.reference, o => o.Reference, value); }
        }

        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<ListDistributorNameDetail, string>(ref this.description, o => o.Description, value); }
        }

        [DefaultValue("")]
        public string Other
        {
            get { return this.other; }
            set { ApplyPropertyChange<ListDistributorNameDetail, string>(ref this.other, o => o.Other, value); }
        }

        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("DistributorModelID", "Please fill a Distributor Model ID.", delegate { return (this.DistributorModelID > 0); }));            

            return validationRules;
        }
    }
}
